import { getmun } from '@api/user'
import { defineStore } from 'pinia'
import { useUserStore } from './useUserstore'
import { Parent } from '@interface/user'
export const userMunStron = defineStore('userMunStron', {
  state: (): {
    userMun: Parent[]
  } => {
    return {
      userMun: []
    }
  },
  getters: {},
  actions: {
    async getmuns() {
      const res = await getmun(useUserStore().rolePerm)
      this.userMun = res.data
    }
  },
  persist: {
    enabled: true, //开启数据缓存
    strategies: [
      {
        storage: localStorage, //默认走session
        // 是否存入指定的值
        paths: ['userMun']
      }
    ]
  }
})
